home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok03.lha
/
IFFtoCode
/
Sources
/
Sprite.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
3KB
|
130 lines
(*********************************************************************)
(*
:Program. SpriteDemo.MOD
:Author. Frank Staudte / Pit Burkhardt
:Address Hasenbergstr.91 7000 Stuttgart 1 W-Germany
:Phone. ----
:shortcut. [fst]+[pit]
:Version. 1.0
:Date. 07.04.88
:Copyright. PD
:Language. Modula-II
:Translator. M2Amiga
:Imports. -
:UpDate. -
:Contents. Little SimpleSprite Demo, Image-MODULE generated by IFFtoSprIm.
:Remark. Thanks to [bne] and [mif].
**********************************************************************)
MODULE Sprite;
FROM Arts IMPORT TermProcedure;
FROM SYSTEM IMPORT ADR, BITSET, CAST;
FROM Heap IMPORT AllocMem;
FROM Hardware IMPORT custom,Custom;
FROM Intuition IMPORT NewScreen,WindowPtr,ScreenPtr,OpenScreen,
CloseScreen,customScreen;
FROM Graphics IMPORT ViewPortPtr,SimpleSpritePtr,ViewModeSet,
sprites, GetSprite,MoveSprite,FreeSprite,
SetRGB4,ChangeSprite;
FROM Img IMPORT Imgheight,ImgPtr,AIR1,AIR2;(* Generated by IFFtoSprIm *)
TYPE
VAR
MyScreen :NewScreen;
wp :WindowPtr;
sp :ScreenPtr;
ViewPort :ViewPortPtr;
SpPtr1 :SimpleSpritePtr;
SprNr1 :INTEGER;
wahr :BOOLEAN;
Coll :BITSET;
XPos,YPos :INTEGER;
AddUp,i :INTEGER;
PROCEDURE Testcollision (VAR wahr : BOOLEAN);
VAR
Bits : BITSET;
BEGIN
Bits := CAST(BITSET,custom.clxdat);
IF 9 IN Bits THEN
wahr := TRUE;
ELSE
wahr := FALSE;
END;
WHILE 9 IN Bits DO
Bits := CAST(BITSET,custom.clxdat);
END;
END Testcollision;
PROCEDURE CleanUp;
BEGIN
FreeSprite(SprNr1);
IF sp<>NIL THEN CloseScreen(sp) END;
END CleanUp;
BEGIN (* Main *)
TermProcedure(CleanUp);
WITH MyScreen DO
leftEdge:=0;
topEdge:=0;
width:=320;
height:=256;
depth:=2;
detailPen:=0;
blockPen:=1;
viewModes:=ViewModeSet{sprites};
type:=customScreen;
font:=NIL;
defaultTitle:=ADR("Touch that simpleSprite to exit");
gadgets:=NIL;
customBitMap:=NIL;
END; (* With *)
AllocMem (SpPtr1,SIZE(SpPtr1^),FALSE);
WITH SpPtr1^ DO
posctldata:=ImgPtr[AIR1];
height:=Imgheight;
x:=100; y:=100;
num:=3;
END;
wp:=NIL;
sp:=OpenScreen(MyScreen);
IF sp#NIL THEN
ViewPort:=ADR(sp^.viewPort);
SetRGB4(ViewPort,0,0,0,0);
SetRGB4(ViewPort,21,12,10,12);
SetRGB4(ViewPort,22,0,0,15);
SetRGB4(ViewPort,23,15,12,15);
SprNr1:=GetSprite(SpPtr1,2);
AddUp:=0;
REPEAT
wahr:=FALSE;
REPEAT
XPos:=320-sp^.mouseX;
YPos:=256-sp^.mouseY;
MoveSprite(ViewPort,SpPtr1,XPos,YPos);
Testcollision(wahr);
UNTIL wahr;
ChangeSprite(ViewPort,SpPtr1,ImgPtr[AIR2]);
FOR i:=0 TO 5000 DO END;
wahr:=FALSE;
REPEAT
XPos:=320-sp^.mouseX;
YPos:=256-sp^.mouseY;
MoveSprite(ViewPort,SpPtr1,XPos,YPos);
Testcollision(wahr);
UNTIL wahr;
ChangeSprite(ViewPort,SpPtr1,ImgPtr[AIR1]);
AddUp:=AddUp+1;
UNTIL AddUp>=100;
END;
END Sprite.